package enumtest;

import java.awt.BorderLayout;
import java.awt.EventQueue;

import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.border.EmptyBorder;
import javax.swing.JComboBox;
import javax.swing.JButton;
import javax.swing.DefaultComboBoxModel;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;

public class MyEnJFrame extends JFrame {

	private JPanel contentPane;

	/**
	 * Launch the application.
	 */
	public static void main(String[] args) {
		EventQueue.invokeLater(new Runnable() {
			public void run() {
				try {
					MyEnJFrame frame = new MyEnJFrame();
					frame.setVisible(true);
				} catch (Exception e) {
					e.printStackTrace();
				}
			}
		});
	}

	/**
	 * Create the frame.
	 */
	public MyEnJFrame() {
		setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		setBounds(100, 100, 525, 382);
		contentPane = new JPanel();
		contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
		setContentPane(contentPane);
		contentPane.setLayout(null);
		
		JComboBox comboBox = new JComboBox();
		comboBox.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				
			}
		});
		comboBox.setModel(new DefaultComboBoxModel(EnType.values()));
		comboBox.setBounds(10, 30, 138, 28);
		contentPane.add(comboBox);
		
		JButton btnShowme = new JButton("Showme");
		btnShowme.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				switch((EnType)comboBox.getSelectedItem()) {
				case ID:System.out.println("ID is doing");break;
				case NAME:System.out.println("Name is doing");break;
				case ADD:System.out.println("ADD is dong");break;
					
				}
				
			}
		});
		btnShowme.setBounds(166, 33, 93, 23);
		contentPane.add(btnShowme);
	}
}
